Continued from 202206251415 Obsidian Misting

Summary of intention:

Upload to GitHub

Created private GitHub repository mihaibirsan/mbirsan-notes: Mihai's private notes.. (This is private repo 3/5.)

git remote add origin git@github.com:mihaibirsan/mbirsan-notes.git

Build with ObsidianHtml

Environment notes

Running this in MINGW64, the version that comes with Git.

$ echo "$SHELL $BASH_VERSION"
/usr/bin/bash 4.4.23(1)-release
$ python -v
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

Running python by itself opened Microsoft Store, and I had to manually select Python 3.7 instead of the latest suggested version.

$ python --version
Python 3.7.9

$ pip install --upgrade pip
…

$ pip --version
pip 22.1.2 from …

$ pip install obsidianhtml
ERROR: Ignored the following versions that require a different python version: …

Installing Python 3.9 instead, planning to deploy static website.

$ export PATH="$PATH:~/AppData/Local/Programs/Python/Python39:~/AppData/Local/Programs/Python/Python39/Scripts"

$ python --version
Python 3.9.13

$ pip --version
pip 22.0.4 from … (python 3.9)

Found out later that the environment variable can be set permanently using SETX in CMD.

SETX PATH "%PATH%;C:\Users\mbirsan\AppData\Local\Programs\Python\Python39;C:\Users\mbirsan\AppData\Local\Programs\Python\Python39\Scripts"

Still, package pythonnet fails to build, one of the dependencies of obsidianhtml.

Create separate worktree

$ vim obsidianhtml-config.yaml

$ git worktree add ../mbirsan-notes-static

$ cd ../mbirsan-notes-static/

$ git checkout --orphan obsidianhtml-build

$ git reset --hard

202207141020 • Continued here.

$ obsidianhtml -i ../Obsidian\ Unified\ Vault/obsidianhtml-config.yaml
ValueError: 'Daily Notes\\2022-07-07' is not in the subpath of 'C:\\Users\\mbirsan\\Dropbox\\Inbox\\mbirsan-notes-static' OR one path is relative and the other is absolute.

Updated the config with absolute paths

$ obsidianhtml -i /c/Users/mbirsan/Dropbox/Inbox/Obsidian\ Unified\ Vault/obsidianhtml-config.yaml
> COPYING VAULT C:\Users\mbirsan\Dropbox\Inbox\Obsidian Unified Vault TO C:\Users\mbirsan\AppData\Local\Temp\tmpsp5ewrf1
< COPYING VAULT: Done
> CLEARING OUTPUT FOLDERS
> CREATING OUTPUT FOLDERS
> COMPILING MARKDOWN FROM OBSIDIAN CODE (C:\Users\mbirsan\AppData\Local\Temp\tmpsp5ewrf1\Daily Notes\2022-07-07)
KeyError: '2022-07-07'

Updated the config to use .md file extension for the index.

$ obsidianhtml -i /c/Users/mbirsan/Dropbox/Inbox/Obsidian\ Unified\ Vault/obsidianhtml-config.yaml
> COPYING VAULT C:\Users\mbirsan\Dropbox\Inbox\Obsidian Unified Vault TO C:\Users\mbirsan\AppData\Local\Temp\tmpwtguk7mg
< COPYING VAULT: Done
> CLEARING OUTPUT FOLDERS
> CREATING OUTPUT FOLDERS
> COMPILING MARKDOWN FROM OBSIDIAN CODE (C:\Users\mbirsan\AppData\Local\Temp\tmpwtguk7mg\Daily Notes\2022-07-07.md)
KeyError: 'ymosx5'

Changed entry file to use Hello.

$ obsidianhtml -i /c/Users/mbirsan/Dropbox/Inbox/Obsidian\ Unified\ Vault/obsidianhtml-config.yaml
> COPYING VAULT C:\Users\mbirsan\Dropbox\Inbox\Obsidian Unified Vault TO C:\Users\mbirsan\AppData\Local\Temp\tmp27rof4gr
< COPYING VAULT: Done
> CLEARING OUTPUT FOLDERS
> CREATING OUTPUT FOLDERS
> COMPILING MARKDOWN FROM OBSIDIAN CODE (C:\Users\mbirsan\AppData\Local\Temp\tmp27rof4gr\Evergreen\Hello.md)
> COMPILING HTML FROM MARKDOWN CODE (C:\Users\mbirsan\Dropbox\Inbox\mbirsan-notes-static\output\md\index.md)
        > FEATURE: BACKLINKS
        < FEATURE: BACKLINKS: Done
< COMPILING HTML FROM MARKDOWN CODE: Done
> COMPILING INDEX FROM DIR STRUCTURE (C:\Users\mbirsan\Dropbox\Inbox\mbirsan-notes-static\output\html\obs.html\dir_index.html)
< COMPILING INDEX FROM DIR STRUCTURE: Done

Only index.html was created, which leads me to believe that notes not linked to from the entry file don't get exported. This behavior is acceptable at this time.

To include all notes, see Process All. This currently fails in my vault, probably due to using links to blocks.

Deploy to Cloudflare Pages

This tutorial also uses Python:

Since the version of Python supported by Couldflare is lower than the minimum required by ObsidianHtml, we'll deploy a static website instead.

202207141205 • Continued here.

202207141220 • By this point I got convinced I'd rather not load the generated HTML to GitHub, since I have static HTML files, I'd rather just upload it. Turns out there's a way to use Direct Upload, something I've stumbled upon previously.

Create Cloudflare Account

Email alexandru.m.birsan@gmail.com and password added to LastPass.

Use Direct Upload

Using Pages Wrangler guide in the Cloudflare Dashboard:

$ npm install -g wrangler
bash: npm: command not found

Switching to Ubuntu.

$ cd /mnt/c/Users/mbirsan/Dropbox/Inbox/mbirsan-notes-static
$ npm install -g wrangler
$ wrangler login
$ CLOUDFLARE_ACCOUNT_ID=62f2042a874f746d251b024953494d65 npx wrangler pages publish output/html
Enter the name of your new project: mihais-notes
Enter the production branch name: obsidianhtml-build
✨ Successfully created the 'mihais-notes' project.
🌏  Uploading... (34/34)

✨ Success! Uploaded 34 files (5.75 sec)

At last! https://mihais-notes.pages.dev/

Future follow-up

Backlinks